package com.leco.demo.spring;

import com.leco.demo.spring.config.AutowiredInvalidTestConfig;
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.context.support.GenericApplicationContext;

import java.util.Arrays;

/**
 * @author greg
 * @version 2022/10/23
 * Autowired失效的场景
 **/
public class AutowiredInvalidDemo {
    public static void main(String[] args) {
        GenericApplicationContext context = new GenericApplicationContext();
        context.registerBean("autowiredInvalidTestConfig", AutowiredInvalidTestConfig.class);
        context.registerBean(ConfigurationClassPostProcessor.class);
        context.registerBean(AutowiredAnnotationBeanPostProcessor.class);

        context.refresh();

        System.out.println(">>>>" + Arrays.toString(context.getBeanDefinitionNames()));

        context.close();
    }
}
